<?php

/**
 * helper
 * 
 * @author
 * @version 
 */
namespace Backend\View\Helper;

use Zend\View\Helper\AbstractHelper;

/**
 * View Helper
 */
class LogonHelper extends AbstractHelper {
	protected $authservice;
	
	public function __invoke($identity) {
		if ($identity->hasIdentity()) {
			$datas = $identity->getStorage()->read();
			
			$prenom = $datas['prenom'];
			$nom = $datas['nom'];
			
			$navHtml = <<<EOQ
	        	<ul class="nav navbar-nav navbar-right navbar-user">
	        		<li class="dropdown user-dropdown">
		              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> $prenom $nom <b class="caret"></b></a>
		              <ul class="dropdown-menu">
		                <li><a href="#"><i class="fa fa-user"></i> Profile</a></li>
		                <li><a href="#"><i class="fa fa-gear"></i> Settings</a></li>
		                <li class="divider"></li>
		                <li><a href="/identification/logout"><i class="fa fa-power-off"></i> Log Out</a></li>
		              </ul>
		            </li>
	        	</ul>
EOQ;
			
			return $navHtml;
		}
		return null;
	}
}
